package com.kandinfo.base.common.enums;

public enum EDataSource {
	
	Homework("家庭作业","homework","dataSource",0),
	Homework_2("家庭作业2","homework_2","dataSource_two",1);

	
	String name;
	String shortName;
	String dataSource;
	int provinceId;
	
	private EDataSource(String name,String shortName,String dataSource,int provinceId){
		this.name=name;
		this.shortName=shortName;
		this.dataSource=dataSource;
		this.provinceId=provinceId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	
	public String getShortName() {
		return shortName;
	}

	public void setShortName(String shortName) {
		this.shortName = shortName;
	}

	public String getDataSource() {
		return dataSource;
	}

	public void setDataSource(String dataSource) {
		this.dataSource = dataSource;
	}

	public int getProvinceId() {
		return provinceId;
	}

	public void setProvinceId(int provinceId) {
		this.provinceId = provinceId;
	}
	
	public static String getDataSourceByProvinceId(int provinceId){
		String dataSource=null;
		for(EDataSource e:EDataSource.values()){
			if(e.getProvinceId()==provinceId){
				dataSource=e.getDataSource();
				break;
			}
		}
		
		if(dataSource==null){
			dataSource=EDataSource.Homework.getDataSource();
		}
		return dataSource;
	}
}
